package edu.wpi.cs509.ui.menu;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;

import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;

import edu.wpi.cs509.ui.GameWindow;

/**
 * A temporary menu to allow fast piece placement during development
 * 
 * @author afoltan
 *
 */
@SuppressWarnings("serial")
public class GameWindowMenu extends JMenuBar {
	
	private GameWindow gameWindow;
	
	/**
	 * Contructor for the game window menu
	 */
	public GameWindowMenu( GameWindow gameWindow ) {
		this.gameWindow = gameWindow;
		addGameMenus();
	}
		
	public void addGameMenus() {
		
		JMenu placementMenus = new JMenu("Placement");
		add(placementMenus);
		
		JMenuItem menuItem = new JMenuItem("Place Remaining Pieces", KeyEvent.VK_A);
		menuItem.getAccessibleContext().setAccessibleDescription("Quick Place All");
		menuItem.addActionListener( new MenuActionPlaceAll(gameWindow) );
		
		placementMenus.add(menuItem);
			
		setVisible(true);
		
	}

	private class MenuActionPlaceAll implements ActionListener {
		
		public MenuActionPlaceAll(GameWindow gameWindow) {

		}

		@Override
		public void actionPerformed(ActionEvent arg0) {
			gameWindow.getGameWindowFrame().quickPlaceRemainingPieces();
		}
	}
}
